<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

<ui:composition template="/restrito/principal.xhtml">
<ui:define name="titulo">
   	Lista de Pessoa Juridica
</ui:define>
<ui:define name="corpo">
<h:form id="listagem">
<p:panel header="Lista Cadastro Pessoa Jurídica" style="width:795px;">   
<p:dataTable id="datatable" var="pjuridica" value="#{pjuridicaBean.lista}"  
	sortBy="#{pjuridica.cod_pessoa}" sortOrder="DESCENDING" 	
	widgetVar="pjuridicaTable" style="width:795px; margin-left:-10px;" paginator="true"
	paginatorPosition="bottom" rows="10" emptyMessage="Nenhum cliente encontrado!" 
	rowsPerPageTemplate="5,10,15" filteredValue="#{pjuridicaBean.pesquisarPJuridica}">	 
	<f:facet name="header">
		<p:commandButton value="Novo Cliente" action="#{pjuridicaBean.novo}" />
		<h:outputText value="Pesquisar Cliente: " style="margin-left:280px;"/>  
		<p:inputText id="globalFilter" onkeyup="pjuridicaTable.filter()" style="width:200px" filterPosition="left"/> 
	</f:facet>
	<p:column id="colunaCodigo" filterBy="#{pjuridica.cod_cnpj}" sortBy="#{pjuridica.cod_cnpj}"  filterStyle="display:none"  style="width:10px; text-align:center;"> 
		<f:facet name="header">
			<h:outputText value="CNPJ"/> 
		</f:facet> 
		<h:outputText value="#{pjuridica.cod_cnpj}" id="cod_cnpj"/>  
	</p:column> 
		           		
	<p:column id="colunaRazao" filterBy="#{pjuridica.des_nome_razao}" filterStyle="display:none" style="width:170px; text-align:center;" > 
		<f:facet name="header">
			<h:outputText value="Razão Social"/> 
		</f:facet> 
		<h:outputText value="#{pjuridica.des_nome_razao}" id="des_nome_razao"/>  
	</p:column> 
		           		
	<p:column id="colunaFone" style="width:70px; text-align:center;" > 
		<f:facet name="header">
			<h:outputText value="Telefone"/> 
		</f:facet> 
		<h:outputText value="#{pjuridica.des_fone}" id="des_fone"/>  
	</p:column> 

	<p:column id="colunaContato" style="width:70px; text-align:center;" > 
		<f:facet name="header">
			<h:outputText value="Pessoa Contato"/> 
		</f:facet> 
		<h:outputText value="#{pjuridica.des_pessoa_contat}" id="des_pessoa_contat"/>  
	</p:column> 

	<p:column id="colunaAlterar" style="width:5px; text-align:center;">
		<f:facet name="header"> 
			<h:outputText value="Alterar"/> 
		</f:facet>	                
		<p:commandLink action="#{pjuridicaBean.alterar}">
			<h:graphicImage library="imagens" name="editar16.png" style="border:0;"/>
			<f:setPropertyActionListener target="#{pjuridicaBean.pjuridica}" value="#{pjuridica}"/>
		</p:commandLink>
	</p:column>
				           		 
   	<p:column id="colunaStatus" style="width:5px; text-align:center;"> 
		<f:facet name="header"> 
			<h:outputText value="Status"/> 
		</f:facet>	                
		<p:commandLink action="#{pjuridicaBean.AlterarStatus}" onclick="if(!confirm('Confirma a mudança de Status?')) return false;" update="datatable">
			<h:graphicImage library="imagens" name="#{pjuridica.ide_inativ}.png" value="" style="border:0;"/>
			<f:setPropertyActionListener target="#{pjuridicaBean.pjuridica}" value="#{pjuridica}"/>
		</p:commandLink>
		<h:outputText rendered="#{pjuridica.ide_inativ == true}" value=" Ativo" /> 
	 	<h:outputText rendered="#{pjuridica.ide_inativ == false}" value=" Inativo" /> 
	</p:column>
</p:dataTable>
</p:panel>
</h:form>	
</ui:define>
</ui:composition> 
</html>
